﻿using Groove.Core.MediaFile;
using Groove.Core.Player;
using System;
using System.IO;

namespace Groove.Test
{
    class Program
    {
        static void Main(string[] args)
        {
            string audioFilePath;
            while (true)
            {
                Console.WriteLine("Enter the path of the audio file to play:");
                audioFilePath = Console.ReadLine();
                if (string.IsNullOrEmpty(audioFilePath)) continue;
                if (!File.Exists(audioFilePath)) continue;
                var fileInfo = new FileInfo(audioFilePath);
                if (!SupportedFileType.IsSupported(fileInfo.Extension))
                {
                    Console.WriteLine("File type not supported!");
                    continue;
                }
                break;
            }            
            var mediaFile = new MediaFile(audioFilePath);
            var player = new FMODPlayerEngine();
            player.Init();
            player.CurrentMediaFile = mediaFile;
            player.PlayOrPause();
            Console.WriteLine("Playing...PRESS ANY KEY TO EXIT!");
            Console.ReadKey();
        }
    }
}
